import {createStore} from 'vuex'
import themeColors from '@/util/themeColors'
import * as storage from '@/util/storage'

const store = createStore({
	state: {
		themeConfig: themeColors[storage.getTheme()],
		wsdata:''
	},
	getters: {
		wsdata:state => state.wsdata,
	},
	mutations: {
		SET_THEME: (state, theme) => {
			state.themeConfig = themeColors[theme]
		},
		SET_WS_DATA: (state, wsdata) => {
		    state.wsdata = wsdata
		},
	},
	actions: {
		setTheme({
			commit
		}, theme) {
			commit('SET_THEME', theme)
		},
		setWsdata({
			commit
		}, wsdata) {
			commit('SET_WS_DATA', wsdata)
		},
	}
})
export default store
